<%@i = 0%>
<%= GMap.header %>
<%= @map.to_html %>
<%= javascript_include_tag 'ufo' %>
<div id="artist_main">
	<h1 class="large_title"><%= @artist.fullname %></h1>
		<p class="sub_h2"><%= Artist.l_attr('from the').gsub(/\{region\}/, (link_to @artist.region.name, @artist.region)) %>
			<div class="col2">
				<div class="left">
				  <script type="text/javascript">
		            var languages = [];
                <% languages = {} %>
		            <% for lang in @artist.artist_descriptions %>
                <% bio = simple_format(lang.biography).gsub("\n", "") %>
	                languages['<%= lang.id%>'] = "<%= bio %>"
		              <% unless lang.personal_statement.nil? || ((lang.personal_statement.is_a? String) && (lang.personal_statement.strip == '')) %>
                    <% ps = simple_format(lang.personal_statement).gsub("\n", "") %>
		                languages['<%= lang.id%>'] += "<h3><%=ArtistDescription.l_attr('ps') %></h3><%= ps %>"
		              <% end %>
                  <% languages[lang.language] = lang.id %>
		            <% end %>
		          </script>
          <% selected = @artist.artist_descriptions.first.id
					user_language = get_hr_language
          if languages.key? user_language
						selected = languages[user_language]
					end
					
					%>
          
          <div class="about_art">          
				  <% if @artist.artist_descriptions.length > 1 %>
            <div style="float:right">
              <%= l(:common, 'language') %>: <%= render :partial => 'shared/description_select', :object => @artist.artist_descriptions, :locals => {:value_method => :id, :text_method => :language, :selected => selected, :update => 'localized_description'} %>        
            </div>
          <% end %>
            <p class="title"><%= l(:common, 'about this artist') %></p>
          </div>
       
          <div id="localized_description"></div>

          <script type="text/javascript">
            $("localized_description").update(languages[<%= selected %>])
          </script>							
				</div>
				<div class="right">
					<div class="flicker" align="center">
						<% @images = Array.new(@artist.medias.size) %>
						<% if @artist.medias.size >0 %>
							<% for @media in @artist.medias %>
								<% if @media.is_a? Picture%>
									<% @images[@i] = '/picture/file/' + @media.file_relative_path("medium") %>
									<% @i = @i +1 %>
								<%end%>
							<% end %>
						<% else %>
							<% l(:common, 'no images') %>
						<%end%>
						<div class="image">
							<img src="" id="thisImageContainer_<%=@i%>"/>
						</div>
						<div>
							<a href="#" id="thisLeftButton_<%=@i%>">&laquo;</a>
							<span id="thisTextContainer_<%=@i%>"></span>
							<a href="#" id="thisRightButton_<%=@i%>">&raquo;</a>
						</div>
						<script>new ImageFlicker("thisLeftButton_<%=@i%>", "thisRightButton_<%=@i%>", "thisImageContainer_<%=@i%>", "thisTextContainer_<%=@i%>", <%= @images.to_json %> ) </script>
						<% @i += 1 %>
					</div>
				</div>
		<div class="col2" style="margin-top: 20px;">
			<div class="left">
				<% @audios = Audio.find_all_by_artist_id(@artist.id)%>
				<% if !@audios.nil? %>
					<% for file in @audios %>
						<%= mp3_player( {:file => "/audio/file/" + file.file_relative_path(nil) + ".mp3", :displayheight => 0}, {:height => 40, :id => file.id} )%>
					<% end %>
				<% end %>
				<% @videos = Video.find_all_by_artist_id(@artist.id)%>
					<% if !(@videos.nil?)%>
						<% for @video in @videos%>
							<%= media_player( 
								{:file => "/video/file/" + video.file_relative_path(subdir = nil)+".flv"},
								{:id => @video.id} )%>
							<% end %>
					<%end%>	
			</div>
			<div class="right">
				<% if @artist.show_map %>
					<%= @map.div(:width => 330, :height => 250) %>
				<% end %>
			</div>
		</div>
		<div id="lists">
					<div class="col2">	
					<%if @otherByArtist.size != 0 %>
					<div id="other_items" class="left">
						<div class="list_head"><%=l(:common, 'art by') %> <%=@artist.name%></div>
							<% j = 1 %>
							<% for a in @otherByArtist %>
								<%= render :partial => '/artworks/show_summary', :locals => {:visType => "columns", :artwork => a, :curr_flicker_id => @i} %>
								<% @i += 1 %>
								<% j+=1%>
								<% if j == 5%>
									<% break %>
								<% end %>
							<%end%>
					</div>
					<%elsif @otherRegionalArt.size != 0%>
						<div id="similiar_items" class="left">
						<div class="list_head"><%=l(:common, 'art in') %> <%=@artist.region.name%></div>
							<% k =0 %>
							<%for a in @otherRegionalArt%>
								<%= render :partial => '/artworks/show_summary', :locals => {:visType => "columns", :artwork => a, :curr_flicker_id => @i} %>
								<%k = k+1 %>
								<%@i += 1%>
								<%if k == 4%>
									<%break %>
								<%end %>
							<%end%>
					</div>
					<%end%>
					<%if @otherRegionalArt.size != 0 && @otherByArtist != 0%>
					<div id="similiar_items" class="right">
						<div class="list_head"><%=l(:common, 'art in') %> <%=@artist.region.name%></div>
							<% k =0 %>
							<%for a in @otherRegionalArt%>
								<%= render :partial => '/artworks/show_summary', :locals => {:visType => "columns", :artwork => a, :curr_flicker_id => @i} %>
								<%k = k+1 %>
								<%@i += 1%>
								<%if k == 4%>
									<%break %>
								<%end %>
							<%end%>
					</div>
					<%end%>
								
					</div>
				</div>
				</div>
				</div>